package com.binest.toolInclusionMain.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.binest.common.annotation.Log;
import com.binest.common.core.controller.BaseController;
import com.binest.common.core.domain.AjaxResult;
import com.binest.common.enums.BusinessType;
import com.binest.toolInclusionMain.domain.ToolInclusionMain;
import com.binest.toolInclusionMain.service.IToolInclusionMainService;
import com.binest.common.utils.poi.ExcelUtil;
import com.binest.common.core.page.TableDataInfo;

/**
 * 工具收录主Controller
 * 
 * @author wwd
 * @date 2024-01-22
 */
@RestController
@RequestMapping("/toolInclusionMain")
public class ToolInclusionMainController extends BaseController
{
    @Autowired
    private IToolInclusionMainService toolInclusionMainService;

    /**
     * 查询工具收录主列表
     */
    @PreAuthorize("@ss.hasPermi('toolInclusionMain:toolInclusionMain:list')")
    @GetMapping("/list")
    public TableDataInfo list(ToolInclusionMain toolInclusionMain)
    {
        startPage();
        List<ToolInclusionMain> list = toolInclusionMainService.selectToolInclusionMainList(toolInclusionMain);
        return getDataTable(list);
    }

    /**
     * 导出工具收录主列表
     */
    @PreAuthorize("@ss.hasPermi('toolInclusionMain:toolInclusionMain:export')")
    @Log(title = "工具收录主", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ToolInclusionMain toolInclusionMain)
    {
        List<ToolInclusionMain> list = toolInclusionMainService.selectToolInclusionMainList(toolInclusionMain);
        ExcelUtil<ToolInclusionMain> util = new ExcelUtil<ToolInclusionMain>(ToolInclusionMain.class);
        util.exportExcel(response, list, "工具收录主数据");
    }

    /**
     * 获取工具收录主详细信息
     */
    @PreAuthorize("@ss.hasPermi('toolInclusionMain:toolInclusionMain:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(toolInclusionMainService.selectToolInclusionMainById(id));
    }

    /**
     * 新增工具收录主
     */
    @PreAuthorize("@ss.hasPermi('toolInclusionMain:toolInclusionMain:add')")
    @Log(title = "工具收录主", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ToolInclusionMain toolInclusionMain)
    {
        return toAjax(toolInclusionMainService.insertToolInclusionMain(toolInclusionMain));
    }

    /**
     * 修改工具收录主
     */
    @PreAuthorize("@ss.hasPermi('toolInclusionMain:toolInclusionMain:edit')")
    @Log(title = "工具收录主", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ToolInclusionMain toolInclusionMain)
    {
        return toAjax(toolInclusionMainService.updateToolInclusionMain(toolInclusionMain));
    }

    /**
     * 删除工具收录主
     */
    @PreAuthorize("@ss.hasPermi('toolInclusionMain:toolInclusionMain:remove')")
    @Log(title = "工具收录主", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(toolInclusionMainService.deleteToolInclusionMainByIds(ids));
    }
}
